<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	template="/layout/template.xhtml">

	<ui:define name="body">

		<h:form id="courseForm">

			<rich:panel>
				<f:facet name="header">#{messages.createAndEditCourse}</f:facet>
				<h:panelGrid columns="1">
				<s:decorate id="nameField" template="/layout/edit.xhtml">
					<ui:define name="label">#{messages.CourseCode}</ui:define>
					<h:inputText id="name" required="true"
						value="#{courseHome.instance.code}" />
				</s:decorate>

				<s:decorate id="codeField" template="/layout/edit.xhtml">
					<ui:define name="label">#{messages.CourseName}</ui:define>
					<h:inputText id="name" required="true"
						value="#{courseHome.instance.name}" />
				</s:decorate>

				<s:decorate id="semester" template="/layout/edit.xhtml">
					<ui:define name="label">#{messages.Semester}</ui:define>
					<h:selectOneMenu id="semesterSelect" value="#{courseHome.instance.semester}"
						tabindex="4" required="true">
						<s:selectItems value="#{semesterList.resultList}" var="s" label="#{s.name}"
							hideNoSelectionLabel="true" />
						<s:convertEntity />
					</h:selectOneMenu>
				</s:decorate>
				
				<s:decorate id="instructorSelect" template="/layout/edit.xhtml">
					<ui:define name="label">#{messages.Instructor}</ui:define>
					<h:selectOneMenu id="insSelect" value="#{courseHome.instance.instructor}"
						tabindex="4" required="true">
						<s:selectItems value="#{userConditionalList.instructorList}" var="ins" label="#{ins.nameToSrting()}"
							hideNoSelectionLabel="true" />
						<s:convertEntity />
					</h:selectOneMenu>
				</s:decorate>
				
				<s:decorate id="TASelect" template="/layout/edit.xhtml">
					<ui:define name="label">#{messages.TeachingAssistant}</ui:define>
					<h:selectOneMenu id="taSel" value="#{courseHome.instance.teachingAssistant}"
						tabindex="4" required="true">
						<s:selectItems value="#{userConditionalList.TAList}" var="ta" label="#{ta.nameToSrting()}"
							hideNoSelectionLabel="true" />
						<s:convertEntity />
					</h:selectOneMenu>
				</s:decorate>
				</h:panelGrid>
			</rich:panel>
			<div class="actionButtons">
				<h:commandButton id="save" value="#{messages.Save}"
					action="#{courseHome.persist}"
					rendered="#{!courseHome.managed}" />
				<h:commandButton id="update" value="#{messages.Update}"
					action="#{courseHome.update}" rendered="#{courseHome.managed}" />
				<h:commandButton id="delete" value="#{messages.Delete}"
					action="#{courseHome.remove}" immediate="true"
					rendered="#{courseHome.managed}" />
				<s:button propagation="end" id="cancel" value="#{messages.Cancel}"
					view="/Instructor/InstructorHome.xhtml" />
			</div>

		</h:form>

	</ui:define>

</ui:composition>